import {adminUrl} from "@/utils/baseUrl.js"
import request from '@/utils/request'

// 创建打卡记录
export function createClockRecord(data) {
  return request({
    url: adminUrl + '/study/clock-record/create',
    method: 'post',
    data: data
  })
}

// 更新打卡记录
export function updateClockRecord(data) {
  return request({
    url: adminUrl + '/study/clock-record/update',
    method: 'put',
    data: data
  })
}

// 删除打卡记录
export function deleteClockRecord(id) {
  return request({
    url: adminUrl + '/study/clock-record/delete?id=' + id,
    method: 'delete'
  })
}

// 获得打卡记录
export function getClockRecord(id) {
  return request({
    url: adminUrl + '/study/clock-record/get?id=' + id,
    method: 'get'
  })
}

// 获得打卡记录分页
export function getClockRecordPage(query) {
  return request({
    url: adminUrl + '/study/clock-record/page',
    method: 'get',
    params: query
  })
}
///admin-api/ 添加请假事由
export function reasonCreate(query) {
  return request({
    url: adminUrl + '/study/attendance-leave-reason/create',
    method: 'post',
    data: query
  })
}
//获得请假事由分页
export function reasonPage(query) {
  return request({
    url: adminUrl + '/study/attendance-leave-reason/page',
    method: 'get',
    params: query
  })
}

// 导出打卡记录 Excel
export function exportClockRecordExcel(query) {
  return request({
    url: adminUrl + '/study/clock-record/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
